import 'package:flutter_taotaoshipin/generated/json/base/json_convert_content.dart';
import 'package:flutter_taotaoshipin/model/drama_ranking_entity.dart';

DramaRankingEntity $DramaRankingEntityFromJson(Map<String, dynamic> json) {
  final DramaRankingEntity dramaRankingEntity = DramaRankingEntity();
  final int? dramaId = jsonConvert.convert<int>(json['drama_id']);
  if (dramaId != null) {
    dramaRankingEntity.dramaId = dramaId;
  }
  final String? dramaName = jsonConvert.convert<String>(json['drama_name']);
  if (dramaName != null) {
    dramaRankingEntity.dramaName = dramaName;
  }
  final String? img = jsonConvert.convert<String>(json['img']);
  if (img != null) {
    dramaRankingEntity.img = img;
  }
  final int? sort = jsonConvert.convert<int>(json['sort']);
  if (sort != null) {
    dramaRankingEntity.sort = sort;
  }
  final String? desc = jsonConvert.convert<String>(json['desc']);
  if (desc != null) {
    dramaRankingEntity.desc = desc;
  }
  final int? allEp = jsonConvert.convert<int>(json['all_ep']);
  if (allEp != null) {
    dramaRankingEntity.allEp = allEp;
  }
  final int? ctime = jsonConvert.convert<int>(json['ctime']);
  if (ctime != null) {
    dramaRankingEntity.ctime = ctime;
  }
  return dramaRankingEntity;
}

Map<String, dynamic> $DramaRankingEntityToJson(DramaRankingEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['drama_id'] = entity.dramaId;
  data['drama_name'] = entity.dramaName;
  data['img'] = entity.img;
  data['sort'] = entity.sort;
  data['desc'] = entity.desc;
  data['all_ep'] = entity.allEp;
  data['ctime'] = entity.ctime;
  return data;
}

extension DramaRankingEntityExtension on DramaRankingEntity {
  DramaRankingEntity copyWith({
    int? dramaId,
    String? dramaName,
    String? img,
    int? sort,
    String? desc,
    int? allEp,
    int? ctime,
  }) {
    return DramaRankingEntity()
      ..dramaId = dramaId ?? this.dramaId
      ..dramaName = dramaName ?? this.dramaName
      ..img = img ?? this.img
      ..sort = sort ?? this.sort
      ..desc = desc ?? this.desc
      ..allEp = allEp ?? this.allEp
      ..ctime = ctime ?? this.ctime;
  }
}